#include "Remote.hpp"

using namespace HeadFirstDesignPatterns::Command::Remote;

int main(int argc, char* argv[]) {
	RemoteControl* remoteControl = new RemoteControl();

	Light* livingRoomLight = new Light("Living Room");
	Light* kitchenLight = new Light("Kitchen");
	CeilingFan* ceilingFan= new CeilingFan("Living Room");
	GarageDoor* garageDoor = new GarageDoor("");
	Stereo* stereo = new Stereo("Living Room");

	LightOnCommand* livingRoomLightOn = 
			new LightOnCommand(livingRoomLight);
	LightOffCommand* livingRoomLightOff = 
			new LightOffCommand(livingRoomLight);
	LightOnCommand* kitchenLightOn = 
			new LightOnCommand(kitchenLight);
	LightOffCommand* kitchenLightOff = 
			new LightOffCommand(kitchenLight);

	CeilingFanOnCommand* ceilingFanOn = 
			new CeilingFanOnCommand(ceilingFan);
	CeilingFanOffCommand* ceilingFanOff = 
			new CeilingFanOffCommand(ceilingFan);

	GarageDoorUpCommand* garageDoorUp =
			new GarageDoorUpCommand(garageDoor);
	GarageDoorDownCommand* garageDoorDown =
			new GarageDoorDownCommand(garageDoor);

	StereoOnWithCDCommand* stereoOnWithCD =
			new StereoOnWithCDCommand(stereo);
	StereoOffCommand* stereoOff =
			new StereoOffCommand(stereo);

	remoteControl->setCommand(0, livingRoomLightOn, livingRoomLightOff);
	remoteControl->setCommand(1, kitchenLightOn, kitchenLightOff);
	remoteControl->setCommand(2, ceilingFanOn, ceilingFanOff);
	remoteControl->setCommand(3, stereoOnWithCD, stereoOff);

	std::cout << remoteControl->toString() << std::endl;

	remoteControl->onButtonWasPushed(0);
	remoteControl->offButtonWasPushed(0);
	remoteControl->onButtonWasPushed(1);
	remoteControl->offButtonWasPushed(1);
	remoteControl->onButtonWasPushed(2);
	remoteControl->offButtonWasPushed(2);
	remoteControl->onButtonWasPushed(3);
	remoteControl->offButtonWasPushed(3);

	return 0;
}